﻿using System;
using System.Collections.Generic;
using System.Text;
using MbUnit.Framework;
using MyTestRunner.Domain;

namespace MyTestRunner.Tests.Domain
{
    /// <summary>
    /// Specifies the behavior of test run results.
    /// </summary>
    [TestFixture]
    [TestsOn(typeof(TestRunResult))]
    public class WhenDeterminingSuccessOfTestRun
    {
        /// <summary>
        /// Given that unexpected exception is null, the method run was a success.
        /// </summary>
        [Test]
        public void ShouldReturnTrueGivenThatUnexpectedExceptionIsNull()
        {
            TestRunResult sut = new TestRunResult(null);
            Assert.IsNull(sut.UnexpectedException);
            Assert.IsTrue(sut.IsSuccess);
        }

        /// <summary>
        /// Given that unexpected exception is not null, the method run was not a success.
        /// </summary>
        [Test]
        public void ShouldReturnFalseGivenThatUnexpectedExceptionIsNotNull()
        {
            TestRunResult sut = new TestRunResult(null, new Exception());
            Assert.IsNotNull(sut.UnexpectedException);
            Assert.IsFalse(sut.IsSuccess);
        }
    }
}
